<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('username', 255);
            $table->string('password', 255);
            $table->string('id_card', 20)->nullable()->comment('身份证号');
            $table->string('description', 255)->nullable();
            $table->boolean('disabled')->default(false);
            $table->string('email', 255)->nullable();
            $table->string('mobile', 255)->nullable();
            $table->string('nickname', 255);
            $table->string('user_id', 255)->nullable();
            $table->integer('group_id')->nullable();
            $table->integer('k12_logout')->default(0);
            $table->string('k12_session_id', 255)->nullable();
            $table->dateTime('created_at')->nullable()->useCurrent();
            $table->bigInteger('creator_id')->nullable()->default(0);
            $table->dateTime('updated_at')->nullable()->useCurrent();
            $table->bigInteger('updater_id')->nullable()->default(0);
            $table->integer('deleted')->default(0);
            $table->integer('curr_role_id')->default(0)->comment('当前用户角色id');
            $table->string('user_type', 5)->default('10000')->comment('用户身份，从左到右每一位分别表示：一般注册用户、行政管理人员、教职员工、学生、家长');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};
